package jUnitTestes;

import org.junit.Test;


public class TestesBinaryConversores {
	
	@Test
	public void testConversor(){
		double [] test = {1.0, 0, 0, 1};
		System.out.println(binaryDoubleToInt(test));
	}
	
	public int binaryDoubleToInt(double valores []){
		int valor = 0;
		int potencia = 0;
		for (int i = (valores.length-1); i >=0 ; i--) {
			valor += (int) (Math.pow(2, potencia)*valores[i]);
			potencia++;
		}
		return valor;
	}

}
